﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace puzzle
{
    public class Warper
    {
        public Box Box1 { get; set; }
        public Box Box2 { get; set; }
        public int Slot1 { get; set; }
        public int Slot2 { get; set; }
        public int ColorID { get; set; }

        public Warper(Box b1, Box b2, int colorID)
        {
            Box1 = b1;
            Box2 = b2;
            ColorID = colorID;
        }

        public bool Equals(Warper w)
        {
            // If parameter is null return false:
            if ((object)w == null)
            {
                return false;
            }

            // Return true if the fields match:
            return (Box1 == w.Box1 && Box2 == w.Box2) || (Box1 == w.Box2 && Box2 == w.Box1);
        }

        public override int GetHashCode()
        {
            return Box1.ID * Box2.ID;
        } 
    }
}
